package flexo.examples;

import flexo.math.Vector;
import flexo.physic.ContactData;
import flexo.physic.collision.*;

public class Test_Physic_CollisionGeneration
{
	public static void main(String[] args)
	{
		ContactData cd = null;
		
		// Sphere & Sphere
		System.out.println("Sphere & Sphere");
		Sphere s1 = new Sphere(new Vector(), 0.5f);
		Sphere s2 = new Sphere(new Vector(0.9f,0,0), 0.5f);
		
		cd = CollisionDetector.check(s1, s2);
		if (cd != null)
		{
			System.out.println("Collision detected!");
		}
		else
		{
			System.out.println("Collision NOT detected!");
		}
		
		// Sphere & Plane
		System.out.println("Sphere & Plane");
		Sphere s3 = new Sphere(new Vector(0,0.49f,0), 0.5f);
		Plane p1 = new Plane();
		
		cd = CollisionDetector.check(s3, p1);
		if (cd != null)
		{
			System.out.println("Collision detected!");
		}
		else
		{
			System.out.println("Collision NOT detected!");
		}
		
		// Box & Plane
		System.out.println("Box & Plane");
		Box b1 = new Box();
		b1.center.set(0,0.49f,0);
		Plane p2 = new Plane();
		
		cd = CollisionDetector.check(b1, p2);
		if (cd != null)
		{
			System.out.println("Collision detected!");
		}
		else
		{
			System.out.println("Collision NOT detected!");
		}
		
		// Sphere & Box
		System.out.println("Sphere & Box");
		Box b2 = new Box();
		Sphere s4 = new Sphere(new Vector(0,1,0),0.5f);
		
		cd = CollisionDetector.check(s4, b2);
		if (cd != null)
		{
			System.out.println("Collision detected!");
		}
		else
		{
			System.out.println("Collision NOT detected!");
		}
		
		// Box & Box
		System.out.println("Box & Box");
		Box b3 = new Box();
		Box b4 = new Box();
		b4.center.set(0,1.1f,0);
		
		cd = CollisionDetector.check(b3, b4);
		if (cd != null)
		{
			System.out.println("Collision detected!");
		}
		else
		{
			System.out.println("Collision NOT detected!");
		}
	}
}
